package joindemo.domain.query;

import io.swagger.v3.oas.annotations.media.Schema;
import joindemo.common.enums.ArticleVisibilityEnum;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serial;
import java.time.LocalDateTime;

/**
 * 文章模块专用分页查询参数
 * @author pym
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Schema(description = "文章分页筛选条件")
public class ArticlePageQuery extends PageQuery {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "搜索关键字 (匹配标题或摘要)")
    private String keyword;

    @Schema(description = "作者ID")
    private Long authorId;

    @Schema(description = "可见性过滤")
    private ArticleVisibilityEnum visibility;

    @Schema(description = "发布起始时间")
    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
    private LocalDateTime startTime;

    @Schema(description = "发布结束时间")
    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
    private LocalDateTime endTime;

    @Schema(description = "是否仅查询公开文章", defaultValue = "true")
    private Boolean onlyPublic = Boolean.TRUE;
}